package com.juzhencms.apps.busi.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.juzhencms.apps.base.common.database.DBTable;


@Service("remote.exampleService")
public class ExampleService extends CommonService{
	
	
	
	public List listData(Map param) {
		
		int num=(int)param.get("num");
		// TODO Auto-generated method stub
		List dataList=this.getJdbcDao().querySql("select id,name,create_time from "+DBTable.example+" where publish=1 limit 0,?", new Object[]{num});
		if(dataList!=null){
			for(int i=0;i<dataList.size();i++){
				Map row=(Map)dataList.get(i);
				row.put("link", this.getLink(row));
			}
		}
		
		return dataList;
	}

	
	public Map pageListData(Map param) {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Map detailData(Map param) {
		// TODO Auto-generated method stub
		Map data=this.getJdbcDao().queryRow("select * from "+DBTable.example+" where id=? and public=1", new Object[]{param.get("id")});
		return data;
	}

	
	public String getLink(Map param) {
		// TODO Auto-generated method stub
		return "/example/"+(int)param.get("id");
	}

	

}
